package com.biubiu.newapplication.activity.vm

import com.biubiu.newapplication.R
import com.biubiu.newapplication.activity.data.Body
import com.biubiu.newapplication.databinding.LayoutItemBodyBinding
import com.biubiu.newapplication.databinding.LayoutItemBottomBinding
import com.biubiu.newapplication.databinding.LayoutItemTopBinding
import com.biubiu.universaladapter.base.vm.DbViewModule

class TopVm: DbViewModule<String, LayoutItemTopBinding>(R.layout.layout_item_top) {

    init {
        setData("")
    }

    override fun onBindData(
        dataBinding: LayoutItemTopBinding,
        data: String,
        dataPosition: Int,
        layoutPosition: Int,
    ) {
        dataBinding.ivTop.setImageResource(R.mipmap.ic_launcher)
    }

}

class BottomVm: DbViewModule<String, LayoutItemBottomBinding>(R.layout.layout_item_bottom) {

    init {
        setData("这是底部")
    }

    override fun onBindData(
        dataBinding: LayoutItemBottomBinding,
        data: String,
        dataPosition: Int,
        layoutPosition: Int,
    ) {
        dataBinding.tvTitle.text = data
    }

}

class BodyVm: DbViewModule<Body, LayoutItemBodyBinding>(R.layout.layout_item_body) {

    override fun onBindData(
        dataBinding: LayoutItemBodyBinding,
        data: Body,
        dataPosition: Int,
        layoutPosition: Int,
    ) {
        dataBinding.ivImage.setImageResource(data.resourceId)
        dataBinding.tvTitle.text = data.title
    }

}